//
//  SettingTableViewCell.m
//  Lovetome
//
//  Created by Xiemaoxiong on 16/7/7.
//  Copyright © 2016年 上海爱途蜜网络科技有限公司. All rights reserved.
//

#import "SettingTableViewCell.h"

@interface SettingTableViewCell()
@property (nonatomic , copy) NSString  *title;
@property (nonatomic , assign) BOOL lineHidden;

@property (nonatomic, strong)  UILabel * iconLabel;
@property (nonatomic, strong)  UILabel * titleLabel;
@property (nonatomic, strong)  UIView  * line;
@end

@implementation SettingTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.iconLabel];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.line];
        
    }
    return self;
}

-(void)initWithDic:(NSDictionary *)Dic {
    NSString *icon = Dic[@"icon"];
    self.iconLabel.text = IconfontName(icon);
    self.titleLabel.text = Dic[@"title"];

}


-(UILabel *)iconLabel {
    if (!_iconLabel) {
        _iconLabel = [[UILabel alloc] init];
        _iconLabel.font = IconFontSize(44);
        _iconLabel.textColor = Color_text_onelever;
    }
    return _iconLabel;
}


-(UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = FontSize(30);
        _titleLabel.textColor = Color_text_onelever;
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

- (UIView *)line {
    if (!_line) {
        _line = [[UIView alloc] init];
        _line.backgroundColor = Color_Line;
    }
    return _line;
}

- (void)layoutSubviews {
    [super layoutSubviews];

    [self.iconLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(Size(44), Size(44)));
        make.centerY.equalTo(self.contentView);
        make.left.mas_equalTo(self.contentView.mas_left).with.offset(Padding(40));

    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(Size(90)));
        make.centerY.equalTo(self.contentView);
        make.left.mas_equalTo(self.iconLabel.mas_right).with.offset(Padding(20));
    }];
    
    
    
    
}

@end
